#include "mytreewidget.h"
#include "ui_mytreewidget.h"
#include <QDebug>
#include <QMessageBox>


myTreeWidget::myTreeWidget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::myTreeWidget)
{
    ui->setupUi(this);
    ui->treeWidget2->setHeaderLabels(QStringList() << "111" << "222");
}

myTreeWidget::~myTreeWidget()
{
    delete ui;
}

void myTreeWidget::OnDoItemPressed(QTreeWidgetItem *item)
{
    qDebug() << item->text(0) << "is pressed";
    QMessageBox::warning(this, tr("Tips"), tr("ItemPressed happen"), QMessageBox::Ok, NULL);
}

//折叠树控件item时触发
void myTreeWidget::on_treeWidget2_itemCollapsed(QTreeWidgetItem *item)
{
    qDebug() <<"item:"<< item->text(0) << "itemCollapsed event happen";
    QMessageBox::warning(this, tr("Tips"), tr("itemCollapsed event"), QMessageBox::Ok, NULL);
}

void myTreeWidget::on_treeWidget2_itemPressed(QTreeWidgetItem *item, int column)
{
    qDebug() <<"item:"<< item->text(0) << "column" << column << "is pressed";
    QMessageBox::warning(this, tr("Tips"), tr("ItemPressed happen"), QMessageBox::Ok, NULL);
}

